﻿//*** Guidance generated code ***//

using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Linq;
using System.Web.Routing;

using ProjectBase.Core;
using ProjectBase.Core.Web;
using ProjectBase.Mvc;

using Survey.Common;
using Survey.Common.Models.Services.HowTos;

namespace Survey.Web.Controls
{
    public class ComplexListView : ListView
    {
        protected override TableCell CreateCellForItem(IItemToDisplay item, ICellDescription cell, int rowNumber, int columnNumber)
        {
            var imageCell = cell as IImageCellDescription;
            if (imageCell.IsNull() || imageCell.ImageUrl.IsEmpty())
            {
                return base.CreateCellForItem(item, cell, rowNumber, columnNumber); // this is not an image
            }
            return new TableCell
            {
                new Image(imageCell.ImageUrl)
                    .SetAlt(imageCell.Title)
            };
        }
    }
}